home *** CD-ROM | disk | FTP | other *** search
/ NBC Slam Jams! / NBC Slam Jams!.iso / coachsed.cst / 00002_Script_moduleManager_Class < prev    next >
Text File  |  1999-06-17  |  2KB  |  81 lines

  1. property moduleList
  2. property currentModule
  3. property openModuleList
  4. property currentWindow
  5. property playPak
  6. property windowRectShape
  7.  
  8. on new me, PlayPakName, windowRect
  9.   global pDelim
  10.   set currentWindow = 0
  11.   set currentModule = 1
  12.   set playPak = playPakName
  13.   set playPakTitle = PlayPakName
  14.   set playPakDataPath = the pathname&playPakTitle&pDelim&"pak.dat"
  15.   set playPakData = readfile(playPakDataPath)
  16.   set the itemDelimiter = ":"
  17.   set playList = [:]
  18.   repeat with i = 1 to the number of lines in playPakData
  19.     if the number of chars in line i of playPakData > 4 then
  20.       addProp playList, item 1 of line i of playPakData, value(item 2 of line i of playPakData)
  21.     end if
  22.   end repeat
  23.   set moduleList = playList
  24.   set windowRectShape = windowRect
  25.   return me
  26. end
  27.  
  28. on openApplet me, appletName
  29.   global webAuthoring
  30.   if voidP(appletName) then
  31.     set appletName = getFileName("?")
  32.   end if
  33.   if appletName <> "File not found" then
  34.     if  NOT(currentWindow = 0) then
  35.       forget currentWindow
  36.     end if
  37.     set webAuthoring = FALSE
  38.     set the windowtype of window appletName to 490
  39.     set x1 = getAt(the rect of the stage,1) + getAt(the rect of sprite windowRectShape,1)
  40.     set y1 = getAt(the rect of the stage,2) + getAt(the rect of sprite windowRectShape,2)
  41.     set x2 = x1 + (the width of sprite windowRectShape)
  42.     set y2 = y1 + (the height of sprite windowRectShape)
  43.     set windowRect = rect(x1,y1,x2,y2)
  44.     set the rect of window appletName to windowRect
  45.     open window appletName
  46.     set currentWindow = getLast(the windowList)  
  47.   end if
  48. end
  49.  
  50. on closeApplet me
  51.   if NOT(currentWindow = 0) then
  52.     forget currentWindow
  53.     set currentWindow = 0
  54.   end if
  55. end
  56.  
  57. on ShowCurrentModuleInfo me 
  58.   set the text of field "PlayName" = getAt(GetAt(moduleList,currentModule),1)
  59.   set the text of field "PlayDescription" = getAt(GetAt(moduleList,currentModule),2)
  60. end
  61.  
  62. on GoNextModule me
  63.   set currentModule = currentModule + 1
  64.   if currentModule > count(moduleList) then set currentModule = 1
  65.   showCurrentModuleInfo me
  66.   closeApplet me
  67. end
  68.  
  69. on GoPreviousModule me
  70.   set currentModule = currentModule - 1
  71.   if currentModule = 0 then set currentModule = count(moduleList)
  72.   showCurrentModuleInfo me
  73.   closeApplet me
  74. end
  75.  
  76.  
  77. on openModule me
  78.   global pDelim
  79.   set currentModuleName = getPropAt(moduleList,currentModule)
  80.   openApplet(me, the pathName&playPak&pDelim¤tModuleName)
  81. end